1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gio.DBusMessage;
26 
27 private import gio.UnixFDList;
28 private import gio.c.functions;
29 public  import gio.c.types;
30 private import glib.ConstructionException;
31 private import glib.ErrorG;
32 private import glib.GException;
33 private import glib.Str;
34 private import glib.Variant;
35 private import glib.c.functions;
36 private import gobject.ObjectG;
37 
38 
39 /**
40  * A type for representing D-Bus messages that can be sent or received
41  * on a #GDBusConnection.
42  *
43  * Since: 2.26
44  */
45 public class DBusMessage : ObjectG
46 {
47 	/** the main Gtk struct */
48 	protected GDBusMessage* gDBusMessage;
49 
50 	/** Get the main Gtk struct */
51 	public GDBusMessage* getDBusMessageStruct(bool transferOwnership = false)
52 	{
53 		if (transferOwnership)
54 			ownedRef = false;
55 		return gDBusMessage;
56 	}
57 
58 	/** the main Gtk struct as a void* */
59 	protected override void* getStruct()
60 	{
61 		return cast(void*)gDBusMessage;
62 	}
63 
64 	/**
65 	 * Sets our main struct and passes it to the parent class.
66 	 */
67 	public this (GDBusMessage* gDBusMessage, bool ownedRef = false)
68 	{
69 		this.gDBusMessage = gDBusMessage;
70 		super(cast(GObject*)gDBusMessage, ownedRef);
71 	}
72 
73 
74 	/** */
75 	public static GType getType()
76 	{
77 		return g_dbus_message_get_type();
78 	}
79 
80 	/**
81 	 * Creates a new empty #GDBusMessage.
82 	 *
83 	 * Returns: A #GDBusMessage. Free with g_object_unref().
84 	 *
85 	 * Since: 2.26
86 	 *
87 	 * Throws: ConstructionException GTK+ fails to create the object.
88 	 */
89 	public this()
90 	{
91 		auto __p = g_dbus_message_new();
92 
93 		if(__p is null)
94 		{
95 			throw new ConstructionException("null returned by new");
96 		}
97 
98 		this(cast(GDBusMessage*) __p, true);
99 	}
100 
101 	/**
102 	 * Creates a new #GDBusMessage from the data stored at @blob. The byte
103 	 * order that the message was in can be retrieved using
104 	 * g_dbus_message_get_byte_order().
105 	 *
106 	 * If the @blob cannot be parsed, contains invalid fields, or contains invalid
107 	 * headers, %G_IO_ERROR_INVALID_ARGUMENT will be returned.
108 	 *
109 	 * Params:
110 	 *     blob = A blob representing a binary D-Bus message.
111 	 *     capabilities = A #GDBusCapabilityFlags describing what protocol features are supported.
112 	 *
113 	 * Returns: A new #GDBusMessage or %NULL if @error is set. Free with
114 	 *     g_object_unref().
115 	 *
116 	 * Since: 2.26
117 	 *
118 	 * Throws: GException on failure.
119 	 * Throws: ConstructionException GTK+ fails to create the object.
120 	 */
121 	public this(char[] blob, GDBusCapabilityFlags capabilities)
122 	{
123 		GError* err = null;
124 
125 		auto __p = g_dbus_message_new_from_blob(blob.ptr, cast(size_t)blob.length, capabilities, &err);
126 
127 		if (err !is null)
128 		{
129 			throw new GException( new ErrorG(err) );
130 		}
131 
132 		if(__p is null)
133 		{
134 			throw new ConstructionException("null returned by new_from_blob");
135 		}
136 
137 		this(cast(GDBusMessage*) __p, true);
138 	}
139 
140 	/**
141 	 * Creates a new #GDBusMessage for a method call.
142 	 *
143 	 * Params:
144 	 *     name = A valid D-Bus name or %NULL.
145 	 *     path = A valid object path.
146 	 *     interface_ = A valid D-Bus interface name or %NULL.
147 	 *     method = A valid method name.
148 	 *
149 	 * Returns: A #GDBusMessage. Free with g_object_unref().
150 	 *
151 	 * Since: 2.26
152 	 *
153 	 * Throws: ConstructionException GTK+ fails to create the object.
154 	 */
155 	public this(string name, string path, string interface_, string method)
156 	{
157 		auto __p = g_dbus_message_new_method_call(Str.toStringz(name), Str.toStringz(path), Str.toStringz(interface_), Str.toStringz(method));
158 
159 		if(__p is null)
160 		{
161 			throw new ConstructionException("null returned by new_method_call");
162 		}
163 
164 		this(cast(GDBusMessage*) __p, true);
165 	}
166 
167 	/**
168 	 * Creates a new #GDBusMessage for a signal emission.
169 	 *
170 	 * Params:
171 	 *     path = A valid object path.
172 	 *     interface_ = A valid D-Bus interface name.
173 	 *     signal = A valid signal name.
174 	 *
175 	 * Returns: A #GDBusMessage. Free with g_object_unref().
176 	 *
177 	 * Since: 2.26
178 	 *
179 	 * Throws: ConstructionException GTK+ fails to create the object.
180 	 */
181 	public this(string path, string interface_, string signal)
182 	{
183 		auto __p = g_dbus_message_new_signal(Str.toStringz(path), Str.toStringz(interface_), Str.toStringz(signal));
184 
185 		if(__p is null)
186 		{
187 			throw new ConstructionException("null returned by new_signal");
188 		}
189 
190 		this(cast(GDBusMessage*) __p, true);
191 	}
192 
193 	/**
194 	 * Utility function to calculate how many bytes are needed to
195 	 * completely deserialize the D-Bus message stored at @blob.
196 	 *
197 	 * Params:
198 	 *     blob = A blob representing a binary D-Bus message.
199 	 *
200 	 * Returns: Number of bytes needed or -1 if @error is set (e.g. if
201 	 *     @blob contains invalid data or not enough data is available to
202 	 *     determine the size).
203 	 *
204 	 * Since: 2.26
205 	 *
206 	 * Throws: GException on failure.
207 	 */
208 	public static ptrdiff_t bytesNeeded(char[] blob)
209 	{
210 		GError* err = null;
211 
212 		auto __p = g_dbus_message_bytes_needed(blob.ptr, cast(size_t)blob.length, &err);
213 
214 		if (err !is null)
215 		{
216 			throw new GException( new ErrorG(err) );
217 		}
218 
219 		return __p;
220 	}
221 
222 	/**
223 	 * Copies @message. The copy is a deep copy and the returned
224 	 * #GDBusMessage is completely identical except that it is guaranteed
225 	 * to not be locked.
226 	 *
227 	 * This operation can fail if e.g. @message contains file descriptors
228 	 * and the per-process or system-wide open files limit is reached.
229 	 *
230 	 * Returns: A new #GDBusMessage or %NULL if @error is set.
231 	 *     Free with g_object_unref().
232 	 *
233 	 * Since: 2.26
234 	 *
235 	 * Throws: GException on failure.
236 	 */
237 	public DBusMessage copy()
238 	{
239 		GError* err = null;
240 
241 		auto __p = g_dbus_message_copy(gDBusMessage, &err);
242 
243 		if (err !is null)
244 		{
245 			throw new GException( new ErrorG(err) );
246 		}
247 
248 		if(__p is null)
249 		{
250 			return null;
251 		}
252 
253 		return ObjectG.getDObject!(DBusMessage)(cast(GDBusMessage*) __p, true);
254 	}
255 
256 	/**
257 	 * Convenience to get the first item in the body of @message.
258 	 *
259 	 * Returns: The string item or %NULL if the first item in the body of
260 	 *     @message is not a string.
261 	 *
262 	 * Since: 2.26
263 	 */
264 	public string getArg0()
265 	{
266 		return Str.toString(g_dbus_message_get_arg0(gDBusMessage));
267 	}
268 
269 	/**
270 	 * Gets the body of a message.
271 	 *
272 	 * Returns: A #GVariant or %NULL if the body is
273 	 *     empty. Do not free, it is owned by @message.
274 	 *
275 	 * Since: 2.26
276 	 */
277 	public Variant getBody()
278 	{
279 		auto __p = g_dbus_message_get_body(gDBusMessage);
280 
281 		if(__p is null)
282 		{
283 			return null;
284 		}
285 
286 		return new Variant(cast(GVariant*) __p);
287 	}
288 
289 	/**
290 	 * Gets the byte order of @message.
291 	 *
292 	 * Returns: The byte order.
293 	 */
294 	public GDBusMessageByteOrder getByteOrder()
295 	{
296 		return g_dbus_message_get_byte_order(gDBusMessage);
297 	}
298 
299 	/**
300 	 * Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field.
301 	 *
302 	 * Returns: The value.
303 	 *
304 	 * Since: 2.26
305 	 */
306 	public string getDestination()
307 	{
308 		return Str.toString(g_dbus_message_get_destination(gDBusMessage));
309 	}
310 
311 	/**
312 	 * Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field.
313 	 *
314 	 * Returns: The value.
315 	 *
316 	 * Since: 2.26
317 	 */
318 	public string getErrorName()
319 	{
320 		return Str.toString(g_dbus_message_get_error_name(gDBusMessage));
321 	}
322 
323 	/**
324 	 * Gets the flags for @message.
325 	 *
326 	 * Returns: Flags that are set (typically values from the #GDBusMessageFlags enumeration bitwise ORed together).
327 	 *
328 	 * Since: 2.26
329 	 */
330 	public GDBusMessageFlags getFlags()
331 	{
332 		return g_dbus_message_get_flags(gDBusMessage);
333 	}
334 
335 	/**
336 	 * Gets a header field on @message.
337 	 *
338 	 * The caller is responsible for checking the type of the returned #GVariant
339 	 * matches what is expected.
340 	 *
341 	 * Params:
342 	 *     headerField = A 8-bit unsigned integer (typically a value from the #GDBusMessageHeaderField enumeration)
343 	 *
344 	 * Returns: A #GVariant with the value if the header was found, %NULL
345 	 *     otherwise. Do not free, it is owned by @message.
346 	 *
347 	 * Since: 2.26
348 	 */
349 	public Variant getHeader(GDBusMessageHeaderField headerField)
350 	{
351 		auto __p = g_dbus_message_get_header(gDBusMessage, headerField);
352 
353 		if(__p is null)
354 		{
355 			return null;
356 		}
357 
358 		return new Variant(cast(GVariant*) __p);
359 	}
360 
361 	/**
362 	 * Gets an array of all header fields on @message that are set.
363 	 *
364 	 * Returns: An array of header fields
365 	 *     terminated by %G_DBUS_MESSAGE_HEADER_FIELD_INVALID.  Each element
366 	 *     is a #guchar. Free with g_free().
367 	 *
368 	 * Since: 2.26
369 	 */
370 	public char[] getHeaderFields()
371 	{
372 		auto __p = g_dbus_message_get_header_fields(gDBusMessage);
373 
374 		return __p[0 .. getArrayLength(__p)];
375 	}
376 
377 	/**
378 	 * Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field.
379 	 *
380 	 * Returns: The value.
381 	 *
382 	 * Since: 2.26
383 	 */
384 	public string getInterface()
385 	{
386 		return Str.toString(g_dbus_message_get_interface(gDBusMessage));
387 	}
388 
389 	/**
390 	 * Checks whether @message is locked. To monitor changes to this
391 	 * value, conncet to the #GObject::notify signal to listen for changes
392 	 * on the #GDBusMessage:locked property.
393 	 *
394 	 * Returns: %TRUE if @message is locked, %FALSE otherwise.
395 	 *
396 	 * Since: 2.26
397 	 */
398 	public bool getLocked()
399 	{
400 		return g_dbus_message_get_locked(gDBusMessage) != 0;
401 	}
402 
403 	/**
404 	 * Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_MEMBER header field.
405 	 *
406 	 * Returns: The value.
407 	 *
408 	 * Since: 2.26
409 	 */
410 	public string getMember()
411 	{
412 		return Str.toString(g_dbus_message_get_member(gDBusMessage));
413 	}
414 
415 	/**
416 	 * Gets the type of @message.
417 	 *
418 	 * Returns: A 8-bit unsigned integer (typically a value from the #GDBusMessageType enumeration).
419 	 *
420 	 * Since: 2.26
421 	 */
422 	public GDBusMessageType getMessageType()
423 	{
424 		return g_dbus_message_get_message_type(gDBusMessage);
425 	}
426 
427 	/**
428 	 * Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header field.
429 	 *
430 	 * Returns: The value.
431 	 *
432 	 * Since: 2.26
433 	 */
434 	public uint getNumUnixFds()
435 	{
436 		return g_dbus_message_get_num_unix_fds(gDBusMessage);
437 	}
438 
439 	/**
440 	 * Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_PATH header field.
441 	 *
442 	 * Returns: The value.
443 	 *
444 	 * Since: 2.26
445 	 */
446 	public string getPath()
447 	{
448 		return Str.toString(g_dbus_message_get_path(gDBusMessage));
449 	}
450 
451 	/**
452 	 * Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL header field.
453 	 *
454 	 * Returns: The value.
455 	 *
456 	 * Since: 2.26
457 	 */
458 	public uint getReplySerial()
459 	{
460 		return g_dbus_message_get_reply_serial(gDBusMessage);
461 	}
462 
463 	/**
464 	 * Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_SENDER header field.
465 	 *
466 	 * Returns: The value.
467 	 *
468 	 * Since: 2.26
469 	 */
470 	public string getSender()
471 	{
472 		return Str.toString(g_dbus_message_get_sender(gDBusMessage));
473 	}
474 
475 	/**
476 	 * Gets the serial for @message.
477 	 *
478 	 * Returns: A #guint32.
479 	 *
480 	 * Since: 2.26
481 	 */
482 	public uint getSerial()
483 	{
484 		return g_dbus_message_get_serial(gDBusMessage);
485 	}
486 
487 	/**
488 	 * Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field.
489 	 *
490 	 * This will always be non-%NULL, but may be an empty string.
491 	 *
492 	 * Returns: The value.
493 	 *
494 	 * Since: 2.26
495 	 */
496 	public string getSignature()
497 	{
498 		return Str.toString(g_dbus_message_get_signature(gDBusMessage));
499 	}
500 
501 	/**
502 	 * Gets the UNIX file descriptors associated with @message, if any.
503 	 *
504 	 * This method is only available on UNIX.
505 	 *
506 	 * The file descriptors normally correspond to %G_VARIANT_TYPE_HANDLE
507 	 * values in the body of the message. For example,
508 	 * if g_variant_get_handle() returns 5, that is intended to be a reference
509 	 * to the file descriptor that can be accessed by
510 	 * `g_unix_fd_list_get (list, 5, ...)`.
511 	 *
512 	 * Returns: A #GUnixFDList or %NULL if no file descriptors are
513 	 *     associated. Do not free, this object is owned by @message.
514 	 *
515 	 * Since: 2.26
516 	 */
517 	public UnixFDList getUnixFdList()
518 	{
519 		auto __p = g_dbus_message_get_unix_fd_list(gDBusMessage);
520 
521 		if(__p is null)
522 		{
523 			return null;
524 		}
525 
526 		return ObjectG.getDObject!(UnixFDList)(cast(GUnixFDList*) __p);
527 	}
528 
529 	/**
530 	 * If @message is locked, does nothing. Otherwise locks the message.
531 	 *
532 	 * Since: 2.26
533 	 */
534 	public void lock()
535 	{
536 		g_dbus_message_lock(gDBusMessage);
537 	}
538 
539 	/**
540 	 * Creates a new #GDBusMessage that is an error reply to @method_call_message.
541 	 *
542 	 * Params:
543 	 *     errorName = A valid D-Bus error name.
544 	 *     errorMessage = The D-Bus error message.
545 	 *
546 	 * Returns: A #GDBusMessage. Free with g_object_unref().
547 	 *
548 	 * Since: 2.26
549 	 */
550 	public DBusMessage newMethodErrorLiteral(string errorName, string errorMessage)
551 	{
552 		auto __p = g_dbus_message_new_method_error_literal(gDBusMessage, Str.toStringz(errorName), Str.toStringz(errorMessage));
553 
554 		if(__p is null)
555 		{
556 			return null;
557 		}
558 
559 		return ObjectG.getDObject!(DBusMessage)(cast(GDBusMessage*) __p, true);
560 	}
561 
562 	/**
563 	 * Like g_dbus_message_new_method_error() but intended for language bindings.
564 	 *
565 	 * Params:
566 	 *     errorName = A valid D-Bus error name.
567 	 *     errorMessageFormat = The D-Bus error message in a printf() format.
568 	 *     varArgs = Arguments for @error_message_format.
569 	 *
570 	 * Returns: A #GDBusMessage. Free with g_object_unref().
571 	 *
572 	 * Since: 2.26
573 	 */
574 	public DBusMessage newMethodErrorValist(string errorName, string errorMessageFormat, void* varArgs)
575 	{
576 		auto __p = g_dbus_message_new_method_error_valist(gDBusMessage, Str.toStringz(errorName), Str.toStringz(errorMessageFormat), varArgs);
577 
578 		if(__p is null)
579 		{
580 			return null;
581 		}
582 
583 		return ObjectG.getDObject!(DBusMessage)(cast(GDBusMessage*) __p, true);
584 	}
585 
586 	/**
587 	 * Creates a new #GDBusMessage that is a reply to @method_call_message.
588 	 *
589 	 * Returns: #GDBusMessage. Free with g_object_unref().
590 	 *
591 	 * Since: 2.26
592 	 */
593 	public DBusMessage newMethodReply()
594 	{
595 		auto __p = g_dbus_message_new_method_reply(gDBusMessage);
596 
597 		if(__p is null)
598 		{
599 			return null;
600 		}
601 
602 		return ObjectG.getDObject!(DBusMessage)(cast(GDBusMessage*) __p, true);
603 	}
604 
605 	/**
606 	 * Produces a human-readable multi-line description of @message.
607 	 *
608 	 * The contents of the description has no ABI guarantees, the contents
609 	 * and formatting is subject to change at any time. Typical output
610 	 * looks something like this:
611 	 * |[
612 	 * Flags:   none
613 	 * Version: 0
614 	 * Serial:  4
615 	 * Headers:
616 	 * path -> objectpath '/org/gtk/GDBus/TestObject'
617 	 * interface -> 'org.gtk.GDBus.TestInterface'
618 	 * member -> 'GimmeStdout'
619 	 * destination -> ':1.146'
620 	 * Body: ()
621 	 * UNIX File Descriptors:
622 	 * (none)
623 	 * ]|
624 	 * or
625 	 * |[
626 	 * Flags:   no-reply-expected
627 	 * Version: 0
628 	 * Serial:  477
629 	 * Headers:
630 	 * reply-serial -> uint32 4
631 	 * destination -> ':1.159'
632 	 * sender -> ':1.146'
633 	 * num-unix-fds -> uint32 1
634 	 * Body: ()
635 	 * UNIX File Descriptors:
636 	 * fd 12: dev=0:10,mode=020620,ino=5,uid=500,gid=5,rdev=136:2,size=0,atime=1273085037,mtime=1273085851,ctime=1272982635
637 	 * ]|
638 	 *
639 	 * Params:
640 	 *     indent = Indentation level.
641 	 *
642 	 * Returns: A string that should be freed with g_free().
643 	 *
644 	 * Since: 2.26
645 	 */
646 	public string print(uint indent)
647 	{
648 		auto retStr = g_dbus_message_print(gDBusMessage, indent);
649 
650 		scope(exit) Str.freeString(retStr);
651 		return Str.toString(retStr);
652 	}
653 
654 	/**
655 	 * Sets the body @message. As a side-effect the
656 	 * %G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field is set to the
657 	 * type string of @body (or cleared if @body is %NULL).
658 	 *
659 	 * If @body is floating, @message assumes ownership of @body.
660 	 *
661 	 * Params:
662 	 *     body_ = Either %NULL or a #GVariant that is a tuple.
663 	 *
664 	 * Since: 2.26
665 	 */
666 	public void setBody(Variant body_)
667 	{
668 		g_dbus_message_set_body(gDBusMessage, (body_ is null) ? null : body_.getVariantStruct());
669 	}
670 
671 	/**
672 	 * Sets the byte order of @message.
673 	 *
674 	 * Params:
675 	 *     byteOrder = The byte order.
676 	 */
677 	public void setByteOrder(GDBusMessageByteOrder byteOrder)
678 	{
679 		g_dbus_message_set_byte_order(gDBusMessage, byteOrder);
680 	}
681 
682 	/**
683 	 * Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field.
684 	 *
685 	 * Params:
686 	 *     value = The value to set.
687 	 *
688 	 * Since: 2.26
689 	 */
690 	public void setDestination(string value)
691 	{
692 		g_dbus_message_set_destination(gDBusMessage, Str.toStringz(value));
693 	}
694 
695 	/**
696 	 * Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field.
697 	 *
698 	 * Params:
699 	 *     value = The value to set.
700 	 *
701 	 * Since: 2.26
702 	 */
703 	public void setErrorName(string value)
704 	{
705 		g_dbus_message_set_error_name(gDBusMessage, Str.toStringz(value));
706 	}
707 
708 	/**
709 	 * Sets the flags to set on @message.
710 	 *
711 	 * Params:
712 	 *     flags = Flags for @message that are set (typically values from the #GDBusMessageFlags
713 	 *         enumeration bitwise ORed together).
714 	 *
715 	 * Since: 2.26
716 	 */
717 	public void setFlags(GDBusMessageFlags flags)
718 	{
719 		g_dbus_message_set_flags(gDBusMessage, flags);
720 	}
721 
722 	/**
723 	 * Sets a header field on @message.
724 	 *
725 	 * If @value is floating, @message assumes ownership of @value.
726 	 *
727 	 * Params:
728 	 *     headerField = A 8-bit unsigned integer (typically a value from the #GDBusMessageHeaderField enumeration)
729 	 *     value = A #GVariant to set the header field or %NULL to clear the header field.
730 	 *
731 	 * Since: 2.26
732 	 */
733 	public void setHeader(GDBusMessageHeaderField headerField, Variant value)
734 	{
735 		g_dbus_message_set_header(gDBusMessage, headerField, (value is null) ? null : value.getVariantStruct());
736 	}
737 
738 	/**
739 	 * Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field.
740 	 *
741 	 * Params:
742 	 *     value = The value to set.
743 	 *
744 	 * Since: 2.26
745 	 */
746 	public void setInterface(string value)
747 	{
748 		g_dbus_message_set_interface(gDBusMessage, Str.toStringz(value));
749 	}
750 
751 	/**
752 	 * Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_MEMBER header field.
753 	 *
754 	 * Params:
755 	 *     value = The value to set.
756 	 *
757 	 * Since: 2.26
758 	 */
759 	public void setMember(string value)
760 	{
761 		g_dbus_message_set_member(gDBusMessage, Str.toStringz(value));
762 	}
763 
764 	/**
765 	 * Sets @message to be of @type.
766 	 *
767 	 * Params:
768 	 *     type = A 8-bit unsigned integer (typically a value from the #GDBusMessageType enumeration).
769 	 *
770 	 * Since: 2.26
771 	 */
772 	public void setMessageType(GDBusMessageType type)
773 	{
774 		g_dbus_message_set_message_type(gDBusMessage, type);
775 	}
776 
777 	/**
778 	 * Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header field.
779 	 *
780 	 * Params:
781 	 *     value = The value to set.
782 	 *
783 	 * Since: 2.26
784 	 */
785 	public void setNumUnixFds(uint value)
786 	{
787 		g_dbus_message_set_num_unix_fds(gDBusMessage, value);
788 	}
789 
790 	/**
791 	 * Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_PATH header field.
792 	 *
793 	 * Params:
794 	 *     value = The value to set.
795 	 *
796 	 * Since: 2.26
797 	 */
798 	public void setPath(string value)
799 	{
800 		g_dbus_message_set_path(gDBusMessage, Str.toStringz(value));
801 	}
802 
803 	/**
804 	 * Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL header field.
805 	 *
806 	 * Params:
807 	 *     value = The value to set.
808 	 *
809 	 * Since: 2.26
810 	 */
811 	public void setReplySerial(uint value)
812 	{
813 		g_dbus_message_set_reply_serial(gDBusMessage, value);
814 	}
815 
816 	/**
817 	 * Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_SENDER header field.
818 	 *
819 	 * Params:
820 	 *     value = The value to set.
821 	 *
822 	 * Since: 2.26
823 	 */
824 	public void setSender(string value)
825 	{
826 		g_dbus_message_set_sender(gDBusMessage, Str.toStringz(value));
827 	}
828 
829 	/**
830 	 * Sets the serial for @message.
831 	 *
832 	 * Params:
833 	 *     serial = A #guint32.
834 	 *
835 	 * Since: 2.26
836 	 */
837 	public void setSerial(uint serial)
838 	{
839 		g_dbus_message_set_serial(gDBusMessage, serial);
840 	}
841 
842 	/**
843 	 * Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field.
844 	 *
845 	 * Params:
846 	 *     value = The value to set.
847 	 *
848 	 * Since: 2.26
849 	 */
850 	public void setSignature(string value)
851 	{
852 		g_dbus_message_set_signature(gDBusMessage, Str.toStringz(value));
853 	}
854 
855 	/**
856 	 * Sets the UNIX file descriptors associated with @message. As a
857 	 * side-effect the %G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header
858 	 * field is set to the number of fds in @fd_list (or cleared if
859 	 * @fd_list is %NULL).
860 	 *
861 	 * This method is only available on UNIX.
862 	 *
863 	 * When designing D-Bus APIs that are intended to be interoperable,
864 	 * please note that non-GDBus implementations of D-Bus can usually only
865 	 * access file descriptors if they are referenced by a value of type
866 	 * %G_VARIANT_TYPE_HANDLE in the body of the message.
867 	 *
868 	 * Params:
869 	 *     fdList = A #GUnixFDList or %NULL.
870 	 *
871 	 * Since: 2.26
872 	 */
873 	public void setUnixFdList(UnixFDList fdList)
874 	{
875 		g_dbus_message_set_unix_fd_list(gDBusMessage, (fdList is null) ? null : fdList.getUnixFDListStruct());
876 	}
877 
878 	/**
879 	 * Serializes @message to a blob. The byte order returned by
880 	 * g_dbus_message_get_byte_order() will be used.
881 	 *
882 	 * Params:
883 	 *     capabilities = A #GDBusCapabilityFlags describing what protocol features are supported.
884 	 *
885 	 * Returns: A pointer to a
886 	 *     valid binary D-Bus message of @out_size bytes generated by @message
887 	 *     or %NULL if @error is set. Free with g_free().
888 	 *
889 	 * Since: 2.26
890 	 *
891 	 * Throws: GException on failure.
892 	 */
893 	public char[] toBlob(GDBusCapabilityFlags capabilities)
894 	{
895 		size_t outSize;
896 		GError* err = null;
897 
898 		auto __p = g_dbus_message_to_blob(gDBusMessage, &outSize, capabilities, &err);
899 
900 		if (err !is null)
901 		{
902 			throw new GException( new ErrorG(err) );
903 		}
904 
905 		return __p[0 .. outSize];
906 	}
907 
908 	/**
909 	 * If @message is not of type %G_DBUS_MESSAGE_TYPE_ERROR does
910 	 * nothing and returns %FALSE.
911 	 *
912 	 * Otherwise this method encodes the error in @message as a #GError
913 	 * using g_dbus_error_set_dbus_error() using the information in the
914 	 * %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field of @message as
915 	 * well as the first string item in @message's body.
916 	 *
917 	 * Returns: %TRUE if @error was set, %FALSE otherwise.
918 	 *
919 	 * Since: 2.26
920 	 *
921 	 * Throws: GException on failure.
922 	 */
923 	public bool toGerror()
924 	{
925 		GError* err = null;
926 
927 		auto __p = g_dbus_message_to_gerror(gDBusMessage, &err) != 0;
928 
929 		if (err !is null)
930 		{
931 			throw new GException( new ErrorG(err) );
932 		}
933 
934 		return __p;
935 	}
936 }